package com.命令模式.案例1;


import lombok.Data;

/**
 * 电灯打开
 */
@Data
public class LightOnComment implements Comment{

    LightReceiver lightReceiver;

    public LightOnComment(LightReceiver lightReceiver) {
        this.lightReceiver = lightReceiver;
    }

    @Override
    public void execute() {
        /**
         * 调用接收者的方法
         */
        lightReceiver.on();
    }

    @Override
    public void undo() {
        lightReceiver.off();
    }
}
